﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace MSRoomLocator.Models
{
    using System.Data.Linq;
    using System.Data.Linq.Mapping;
    using System.Data;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Linq;
    using System.Linq.Expressions;
    using System.ComponentModel;
    using System;


    public class DataClassesDataContext : DataContext
    {
        public DataClassesDataContext(string connection) :
            base(connection)
        { }

        public Table<Building> Buildings;
        public Table<Room> Rooms;
    }

    [Table]
    public partial class Building : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private int _ID;

        private string _Name;

        private string _Address;

        private double _TopLeftLatitude;

        private double _TopLeftLongitude;

        private double _BottomRightLatitude;

        private double _BottomRightLongitude;

        private double _Latitude;

        private double _Longitude;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnIDChanging(int value);
        partial void OnIDChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        partial void OnTopLeftLatitudeChanging(double value);
        partial void OnTopLeftLatitudeChanged();
        partial void OnTopLeftLongitudeChanging(double value);
        partial void OnTopLeftLongitudeChanged();
        partial void OnBottomRightLatitudeChanging(double value);
        partial void OnBottomRightLatitudeChanged();
        partial void OnBottomRightLongitudeChanging(double value);
        partial void OnBottomRightLongitudeChanged();
        partial void OnLatitudeChanging(double value);
        partial void OnLatitudeChanged();
        partial void OnLongitudeChanging(double value);
        partial void OnLongitudeChanged();
        #endregion

        public Building()
        {
            OnCreated();
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ID", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                if ((this._ID != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._ID = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Name", DbType = "NVarChar(64) NOT NULL", CanBeNull = false)]
        public string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                if ((this._Name != value))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._Name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Address", DbType = "NVarChar(128)")]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                if ((this._Address != value))
                {
                    this.OnAddressChanging(value);
                    this.SendPropertyChanging();
                    this._Address = value;
                    this.SendPropertyChanged("Address");
                    this.OnAddressChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_TopLeftLatitude", DbType = "Float NOT NULL")]
        public double TopLeftLatitude
        {
            get
            {
                return this._TopLeftLatitude;
            }
            set
            {
                if ((this._TopLeftLatitude != value))
                {
                    this.OnTopLeftLatitudeChanging(value);
                    this.SendPropertyChanging();
                    this._TopLeftLatitude = value;
                    this.SendPropertyChanged("TopLeftLatitude");
                    this.OnTopLeftLatitudeChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_TopLeftLongitude", DbType = "Float NOT NULL")]
        public double TopLeftLongitude
        {
            get
            {
                return this._TopLeftLongitude;
            }
            set
            {
                if ((this._TopLeftLongitude != value))
                {
                    this.OnTopLeftLongitudeChanging(value);
                    this.SendPropertyChanging();
                    this._TopLeftLongitude = value;
                    this.SendPropertyChanged("TopLeftLongitude");
                    this.OnTopLeftLongitudeChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_BottomRightLatitude", DbType = "Float NOT NULL")]
        public double BottomRightLatitude
        {
            get
            {
                return this._BottomRightLatitude;
            }
            set
            {
                if ((this._BottomRightLatitude != value))
                {
                    this.OnBottomRightLatitudeChanging(value);
                    this.SendPropertyChanging();
                    this._BottomRightLatitude = value;
                    this.SendPropertyChanged("BottomRightLatitude");
                    this.OnBottomRightLatitudeChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_BottomRightLongitude", DbType = "Float NOT NULL")]
        public double BottomRightLongitude
        {
            get
            {
                return this._BottomRightLongitude;
            }
            set
            {
                if ((this._BottomRightLongitude != value))
                {
                    this.OnBottomRightLongitudeChanging(value);
                    this.SendPropertyChanging();
                    this._BottomRightLongitude = value;
                    this.SendPropertyChanged("BottomRightLongitude");
                    this.OnBottomRightLongitudeChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Latitude", DbType = "Float NOT NULL")]
        public double Latitude
        {
            get
            {
                return this._Latitude;
            }
            set
            {
                if ((this._Latitude != value))
                {
                    this.OnLatitudeChanging(value);
                    this.SendPropertyChanging();
                    this._Latitude = value;
                    this.SendPropertyChanged("Latitude");
                    this.OnLatitudeChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Longitude", DbType = "Float NOT NULL")]
        public double Longitude
        {
            get
            {
                return this._Longitude;
            }
            set
            {
                if ((this._Longitude != value))
                {
                    this.OnLongitudeChanging(value);
                    this.SendPropertyChanging();
                    this._Longitude = value;
                    this.SendPropertyChanged("Longitude");
                    this.OnLongitudeChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table]
    public partial class FloorPlan : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private int _ID;

        private int _Floor;

        private string _Building;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnIDChanging(int value);
        partial void OnIDChanged();
        partial void OnFloorChanging(int value);
        partial void OnFloorChanged();
        partial void OnBuildingChanging(string value);
        partial void OnBuildingChanged();
        #endregion

        public FloorPlan()
        {
            OnCreated();
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ID", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                if ((this._ID != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._ID = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Floor", DbType = "Int NOT NULL")]
        public int Floor
        {
            get
            {
                return this._Floor;
            }
            set
            {
                if ((this._Floor != value))
                {
                    this.OnFloorChanging(value);
                    this.SendPropertyChanging();
                    this._Floor = value;
                    this.SendPropertyChanged("Floor");
                    this.OnFloorChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Building", DbType = "NVarChar(64) NOT NULL", CanBeNull = false)]
        public string Building
        {
            get
            {
                return this._Building;
            }
            set
            {
                if ((this._Building != value))
                {
                    this.OnBuildingChanging(value);
                    this.SendPropertyChanging();
                    this._Building = value;
                    this.SendPropertyChanged("Building");
                    this.OnBuildingChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table]
    public partial class Room : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private int _ID;

        private string _Name;

        private string _Alias;

        private string _Building;

        private string _LabAccount;

        private double _OffsetX;

        private double _OffsetY;

        private int _Floor;

        private string _FloorPlan;

        private int _FloorPlanID;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnIDChanging(int value);
        partial void OnIDChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnAliasChanging(string value);
        partial void OnAliasChanged();
        partial void OnBuildingChanging(string value);
        partial void OnBuildingChanged();
        partial void OnLabAccountChanging(string value);
        partial void OnLabAccountChanged();
        partial void OnOffsetXChanging(double value);
        partial void OnOffsetXChanged();
        partial void OnOffsetYChanging(double value);
        partial void OnOffsetYChanged();
        partial void OnFloorChanging(int value);
        partial void OnFloorChanged();
        partial void OnFloorPlanChanging(string value);
        partial void OnFloorPlanChanged();
        partial void OnFloorPlanIDChanging(int value);
        partial void OnFloorPlanIDChanged();
        #endregion

        public Room()
        {
            OnCreated();
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ID", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                if ((this._ID != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._ID = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Name", DbType = "NVarChar(256) NOT NULL", CanBeNull = false)]
        public string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                if ((this._Name != value))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._Name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Alias", DbType = "NVarChar(64)")]
        public string Alias
        {
            get
            {
                return this._Alias;
            }
            set
            {
                if ((this._Alias != value))
                {
                    this.OnAliasChanging(value);
                    this.SendPropertyChanging();
                    this._Alias = value;
                    this.SendPropertyChanged("Alias");
                    this.OnAliasChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Building", DbType = "NVarChar(128) NOT NULL", CanBeNull = false)]
        public string Building
        {
            get
            {
                return this._Building;
            }
            set
            {
                if ((this._Building != value))
                {
                    this.OnBuildingChanging(value);
                    this.SendPropertyChanging();
                    this._Building = value;
                    this.SendPropertyChanged("Building");
                    this.OnBuildingChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_LabAccount", DbType = "NVarChar(64)")]
        public string LabAccount
        {
            get
            {
                return this._LabAccount;
            }
            set
            {
                if ((this._LabAccount != value))
                {
                    this.OnLabAccountChanging(value);
                    this.SendPropertyChanging();
                    this._LabAccount = value;
                    this.SendPropertyChanged("LabAccount");
                    this.OnLabAccountChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_OffsetX", DbType = "Float NOT NULL")]
        public double OffsetX
        {
            get
            {
                return this._OffsetX;
            }
            set
            {
                if ((this._OffsetX != value))
                {
                    this.OnOffsetXChanging(value);
                    this.SendPropertyChanging();
                    this._OffsetX = value;
                    this.SendPropertyChanged("OffsetX");
                    this.OnOffsetXChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_OffsetY", DbType = "Float NOT NULL")]
        public double OffsetY
        {
            get
            {
                return this._OffsetY;
            }
            set
            {
                if ((this._OffsetY != value))
                {
                    this.OnOffsetYChanging(value);
                    this.SendPropertyChanging();
                    this._OffsetY = value;
                    this.SendPropertyChanged("OffsetY");
                    this.OnOffsetYChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Floor", DbType = "Int NOT NULL")]
        public int Floor
        {
            get
            {
                return this._Floor;
            }
            set
            {
                if ((this._Floor != value))
                {
                    this.OnFloorChanging(value);
                    this.SendPropertyChanging();
                    this._Floor = value;
                    this.SendPropertyChanged("Floor");
                    this.OnFloorChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_FloorPlan", DbType = "NVarChar(128) NOT NULL", CanBeNull = false)]
        public string FloorPlan
        {
            get
            {
                return this._FloorPlan;
            }
            set
            {
                if ((this._FloorPlan != value))
                {
                    this.OnFloorPlanChanging(value);
                    this.SendPropertyChanging();
                    this._FloorPlan = value;
                    this.SendPropertyChanged("FloorPlan");
                    this.OnFloorPlanChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_FloorPlanID", DbType = "Int NOT NULL")]
        public int FloorPlanID
        {
            get
            {
                return this._FloorPlanID;
            }
            set
            {
                if ((this._FloorPlanID != value))
                {
                    this.OnFloorPlanIDChanging(value);
                    this.SendPropertyChanging();
                    this._FloorPlanID = value;
                    this.SendPropertyChanged("FloorPlanID");
                    this.OnFloorPlanIDChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table]
    public partial class PlanPath : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private string _Data;

        private int _FloorPlanID;

        private int _ID;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnDataChanging(string value);
        partial void OnDataChanged();
        partial void OnFloorPlanIDChanging(int value);
        partial void OnFloorPlanIDChanged();
        partial void OnIDChanging(int value);
        partial void OnIDChanged();
        #endregion

        public PlanPath()
        {
            OnCreated();
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Data", DbType = "NText NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public string Data
        {
            get
            {
                return this._Data;
            }
            set
            {
                if ((this._Data != value))
                {
                    this.OnDataChanging(value);
                    this.SendPropertyChanging();
                    this._Data = value;
                    this.SendPropertyChanged("Data");
                    this.OnDataChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_FloorPlanID", DbType = "Int NOT NULL")]
        public int FloorPlanID
        {
            get
            {
                return this._FloorPlanID;
            }
            set
            {
                if ((this._FloorPlanID != value))
                {
                    this.OnFloorPlanIDChanging(value);
                    this.SendPropertyChanging();
                    this._FloorPlanID = value;
                    this.SendPropertyChanged("FloorPlanID");
                    this.OnFloorPlanIDChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ID", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                if ((this._ID != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._ID = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table]
    public partial class PlanCircle : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private int _ID;

        private double _CR;

        private double _CX;

        private double _CY;

        private int _FloorPlanID;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnIDChanging(int value);
        partial void OnIDChanged();
        partial void OnCRChanging(double value);
        partial void OnCRChanged();
        partial void OnCXChanging(double value);
        partial void OnCXChanged();
        partial void OnCYChanging(double value);
        partial void OnCYChanged();
        partial void OnFloorPlanIDChanging(int value);
        partial void OnFloorPlanIDChanged();
        #endregion

        public PlanCircle()
        {
            OnCreated();
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ID", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                if ((this._ID != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._ID = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CR", DbType = "Float NOT NULL")]
        public double CR
        {
            get
            {
                return this._CR;
            }
            set
            {
                if ((this._CR != value))
                {
                    this.OnCRChanging(value);
                    this.SendPropertyChanging();
                    this._CR = value;
                    this.SendPropertyChanged("CR");
                    this.OnCRChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CX", DbType = "Float NOT NULL")]
        public double CX
        {
            get
            {
                return this._CX;
            }
            set
            {
                if ((this._CX != value))
                {
                    this.OnCXChanging(value);
                    this.SendPropertyChanging();
                    this._CX = value;
                    this.SendPropertyChanged("CX");
                    this.OnCXChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_CY", DbType = "Float NOT NULL")]
        public double CY
        {
            get
            {
                return this._CY;
            }
            set
            {
                if ((this._CY != value))
                {
                    this.OnCYChanging(value);
                    this.SendPropertyChanging();
                    this._CY = value;
                    this.SendPropertyChanged("CY");
                    this.OnCYChanged();
                }
            }
        }

        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_FloorPlanID", DbType = "Int NOT NULL")]
        public int FloorPlanID
        {
            get
            {
                return this._FloorPlanID;
            }
            set
            {
                if ((this._FloorPlanID != value))
                {
                    this.OnFloorPlanIDChanging(value);
                    this.SendPropertyChanging();
                    this._FloorPlanID = value;
                    this.SendPropertyChanged("FloorPlanID");
                    this.OnFloorPlanIDChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
